package org.oslims.client;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.DialogBox;

public abstract class AsyncCall<T> implements AsyncCallback<T> {

	DialogBox loadingBox = new DialogBox(false, true);

	public AsyncCall() {
		// Image i = new Image("/img/ajax-loader.gif");
		// loadingBox.add(i);
		// loadingBox.center();
	}

	public final void onFailure(Throwable caught) {
		// loadingBox.hide();
		onFailureE(caught);
	}

	public final void onSuccess(T result) {
		// loadingBox.hide();
		onSuccessE(result);
	}

	/** the failure method needed to be overwritte */
	protected abstract void onFailureE(Throwable caught);

	/** overwritte to do something with result */
	protected abstract void onSuccessE(T result);

}
